package admin

import (
	. "go-caipu/pkg/services/sqlstore/migrator"
)

func AddCasbinRuleMigrations(mg *Migrator) {
	userV1 := Table{
		Name: "sys_casbin_rule",
		Columns: []*Column{
			{Name: "p_type", Type: DB_NVarchar, Length: 100, Nullable: true},
			{Name: "v0", Type: DB_NVarchar, Length: 100, Nullable: true},
			{Name: "backend", Type: DB_NVarchar, Length: 100, Nullable: true},
			{Name: "v2", Type: DB_NVarchar, Length: 100, Nullable: true},
			{Name: "v3", Type: DB_NVarchar, Length: 100, Nullable: true},
			{Name: "v4", Type: DB_NVarchar, Length: 100, Nullable: true},
			{Name: "v5", Type: DB_NVarchar, Length: 100, Nullable: true},
		},
		Indices: []*Index{
			{Cols: []string{"p_type"}, Type: UniqueIndex},
		},
	}
	//create table

	mg.AddMigration("create sys_casbin_rule table", NewAddTableMigration(userV1))
}
